#!/bin/bash
file="$1"
remotedir="$2"
. /etc/init.d/functions
if [ $# -ne 2 ];then
        echo "USAGE:/bin/sh $0 arg1 arg2"
        exit 1
fi
if [ -f $file ];then
        for n in 107 104;do
                scp -P22 -rp $file test@10.100.100.$n:~ >/dev/null && ssh -p22 -t test@10.100.100.$n sudo /bin/cp ~/$(basename $file) $remotedir
                if [ $? -eq 0 ];then
                        action "scp $file to $remotedir is ok" /bin/true
                else

                        action "scp $file to $remotedir is ok" /bin/false
                fi
        done
else
        echo "$file is not exsit"
fi

